<extend name="Public:base" />
<block name="main">
	<div class="content" id="js-date">
		<section class="location">
			<i class="iconfont">&#xe60f</i> 位置：<a href="{:U('Index/main')}">管理首页</a> &gt; <a href="{:U('index')}">广告管理</a> &gt; 编辑广告
		</section>
		<ul class="nav-tabs clearfix">
			<li><a href="{:U('index')}">广告管理</a></li>
			<li><a href="{:U('add')}">发布广告</a></li>
			<li class="active">编辑广告</li>
		</ul>
		<form method="post" action="" id="form">
			<input type="hidden" name="id" id="id" value="{$viewInfo.id}" />
			<input type="hidden" name="cid" id="cid" value="{$viewInfo.cid}" />
			<input type="hidden" name="class" id="class" value="{$Think.CONTROLLER_NAME}" />
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
			<tr>
				<th width="100">广告位置</th>
				<td>
					<select name="category_id" id="category_id" class="form-control">
						<option value="0">首页</option>
						<foreach name="category" item="list">
						<option value="{$list.id}" <if condition="$list.id eq $viewInfo['category_id']">selected</if>>{$list.delimiter}<if condition="$list.parent_id neq 0">├─</if>{$list.name}</option>
						</foreach>
					</select>
				</td>
			</tr>
			<tr>
				<th>标题</th>
				<td><input type="text" name="title" id="title" class="form-control form-control-lg" value="{$viewInfo.title}" required /> <span class="red"> *</span> </td>
			</tr>
			<tr>
				<th>图片相册</th>
				<td>
    				<div class="img_box clearfix" id="img_box">
						<volist name="gallery" id="info">
						<div class="list-gallery">	
							<figure class="img_info"><img src="__ROOT__{$info.image_src}" alt="{$info.name}" class="img" /><figcaption class="title">{$info.name}</figcaption><figcaption class="desc">{$info.desc}</figcaption><figcaption>排序：<span class="sort">{$info.order_id}</span></figcaption></figure>
							<div class="img_ctrl">
								<span class="btn glyphicon-tag" title="修改名称"><i class="iconfont">&#xe607</i></span>
								<span class="btn glyphicon-desc" title="修改简介"><i class="iconfont">&#xe607</i></span>
								<span class="btn glyphicon-sort" title="修改排序"><i class="iconfont">&#xe606</i></span>
								<span class="btn glyphicon-trash" title="删除文件"><i class="iconfont">&#xe60d</i></span>
							</div>
							<div class="img_name">
								<input type="text" class="form-control savename" value="{$info.name}" />
								<button class="btn btn-primary save_name inline-block">保存</button>
							</div>
							<div class="img_desc">
								<textarea class="form-control form-control-md savedesc">{$info.desc}</textarea>
								<button class="btn btn-primary save_desc inline-block">保存</button>
							</div>
							<div class="img_sort">
								<input type="text" class="form-control savesort" value="{$info.order_id}" />
								<button class="btn btn-primary save_sort inline-block">保存</button>
							</div>
						</div>
						</volist>
					</div>
					<input type="file" name="btn_upload_gallery" id="btn_upload_gallery" multiple />
				</td>
			</tr>
			<tr>
				<th>发布时间</th>
				<td><input type="text" name="start_time" id="start_time" class="form-control form-control-time js-date" value="{$viewInfo.start_time}" /></td>
			</tr>
			<tr>
				<th>结束时间</th>
				<td><input type="text" name="end_time" id="end_time" class="form-control form-control-time js-date" value="{$viewInfo.end_time}" /></td>
			</tr>
			<tr>
				<th>链接</th>
				<td><textarea name="url" id="url" class="form-control form-control-lg">{$viewInfo.url}</textarea><span id="tip">请依图片填写链接，以小写“,”区分</span></td>
			</tr>
			<tr>
				<th>说明</th>
				<td><textarea name="description" id="description" class="form-control form-control-lg">{$viewInfo.description}</textarea></td>
			</tr>
			</table>
			<div class="well"><button type="submit" class="btn btn-theme" id="submit_save">保 存</button> <button class="btn btn-gary" onclick="javascript:history.back(-1);">返 回</button></div>
		</form>
	</div>
</block>